﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="posts.aspx.vb" Inherits="Web_2._0_BMW___X6_Experts_Web_Application.posts" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">


        .discussionInformation
        {
            height: 1050px;
        }
        .style2
        {
            font-style: normal;
            font-size: large;
            color: #3366FF;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p style="font-size: x-large; font-weight: bolder; text-decoration: underline;">
        BMW - X6 Discussion Forum - <em>Reply to the discussion...</em></p>
    <div class="discussionInformation">
        <span class="st">
        <br />

    <div class = "posts">
    
    
    
        <asp:FormView ID="FormView1" runat="server" DataKeyNames="DiscussionID" 
            DataSourceID="SqlDataSource2" Width="869px" Font-Bold="True" 
            Font-Italic="True" Font-Size="Medium" ForeColor="#FF6600" Height="81px">
            <EditItemTemplate>

                Title:
                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                Title:
                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                <br />
                <span class="style2">Title: <em>
                <asp:Label ID="TitleLabel" runat="server" style="text-align: left" 
                    Text='<%# Bind("Title") %>' />
                </em></span>
                <br />

            </ItemTemplate>
        </asp:FormView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            
            SelectCommand="SELECT [DiscussionID], [Title] FROM [Discussion] WHERE ([DiscussionID] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="DiscussionID" QueryStringField="id" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    
    
    
    </div>
    <br />

    <div class = "posts">
    
    
        Below are the posts replied to the discussion title shown above. To add a reply, 
        you must be a registered user and logged in.
    
    
        Click here to <a href = "Account/Register.aspx">Register</a> or <a href = "Account/Login.aspx">Login</a>.</div>
    <br />

    <div class = "postsUnedited">
    
    
    
    
        <asp:ListView ID="ListView1" runat="server" 
            DataSourceID="SqlDataSource1" 
            style="font-family: Calibri; font-size: small">
            <AlternatingItemTemplate>
                
                <strong>Post Message Replied:</strong>
                <asp:Label ID="PostBodyLabel" runat="server" Text='<%# Eval("PostBody") %>' />
                <br />
                <strong>Date Posted:</strong>
                <asp:Label ID="DatePostedLabel" runat="server" 
                    Text='<%# Eval("DatePosted") %>' />
                <br />
                <strong>Time Posted:</strong>
                <asp:Label ID="TimePostedLabel" runat="server" 
                    Text='<%# Eval("TimePosted") %>' />
                <br />
                <strong>Posted by:</strong>
                <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                <br />
<br /></span>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                
                
                <br /><strong>Post Message Replied:</strong>
                <asp:TextBox ID="PostBodyTextBox" runat="server" 
                    Text='<%# Bind("PostBody") %>' />
                <br />
                Date Posted:
                <asp:TextBox ID="DatePostedTextBox" runat="server" 
                    Text='<%# Bind("DatePosted") %>' />
                <br />
                Time Posted:
                <asp:TextBox ID="TimePostedTextBox" runat="server" 
                    Text='<%# Bind("TimePosted") %>' />
                <br />
                
                <br />Posted by:
                <asp:TextBox ID="UserNameTextBox" runat="server" 
                    Text='<%# Bind("UserName") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
                <br />
                <br /></span>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <span>No data was returned.</span>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <span style="">
                <strong>Post Message Replied:</strong>
                <asp:TextBox ID="PostBodyTextBox" runat="server" 
                    Text='<%# Bind("PostBody") %>' />
                <br />Date Posted:
                <asp:TextBox ID="DatePostedTextBox" runat="server" 
                    Text='<%# Bind("DatePosted") %>' />
                <br />Time Posted:
                <asp:TextBox ID="TimePostedTextBox" runat="server" 
                    Text='<%# Bind("TimePosted") %>' />
                <br>
                </br>
                <br />UserName:
                <asp:TextBox ID="UserNameTextBox" runat="server" 
                    Text='<%# Bind("UserName") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
                <br /><br /></span>
            </InsertItemTemplate>
            <ItemTemplate>
                <strong>Post Message Replied:</strong>
                <asp:Label ID="PostBodyLabel" runat="server" Text='<%# Eval("PostBody") %>' />
                <br />
                <strong>Date Posted:</strong>
                <asp:Label ID="DatePostedLabel" runat="server" 
                    Text='<%# Eval("DatePosted") %>' />
                <br />
                <strong>Time Posted:</strong>
                <asp:Label ID="TimePostedLabel" runat="server" 
                    Text='<%# Eval("TimePosted") %>' />
                <br />
                <strong>Posted by:</strong>
                <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                <br />
<br /></span>
            </ItemTemplate>
            <LayoutTemplate>
                <div ID="itemPlaceholderContainer" runat="server" 
                    style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                    <span runat="server" id="itemPlaceholder" />
                </div>
                 <div style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                     <asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="10">
                            
                                <Fields>
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                        ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                    <asp:NumericPagerField />
                                    <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                        ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                </Fields>
                            </asp:DataPager>
                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <span style="background-color: #008A8C; font-weight: bold;color: #FFFFFF;">
                
                <strong>Post Message Replied:</strong>
                <asp:Label ID="PostBodyLabel" runat="server" Text='<%# Eval("PostBody") %>' />
                <br />
                Date Posted:
                <asp:Label ID="DatePostedLabel" runat="server" 
                    Text='<%# Eval("DatePosted") %>' />
                <br />
                Time Posted:
                <asp:Label ID="TimePostedLabel" runat="server" 
                    Text='<%# Eval("TimePosted") %>' />
                <br />
                UserName:
                <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                <br />
<br /></span>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
            
            SelectCommand="SELECT Posts.PostBody, Posts.DatePosted, Posts.TimePosted, Posts.DiscussionIDFK, Posts.PostID, aspnet_Users.UserName FROM (Posts INNER JOIN aspnet_Users ON Posts.UserIDFK = aspnet_Users.UserId) WHERE (Posts.DiscussionIDFK = ?) ORDER BY Posts.PostID DESC">
            <SelectParameters>
                <asp:QueryStringParameter Name="DiscussionIDFK" QueryStringField="id" 
                    Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    
    
    
    
    </div>
        </span>
</asp:Content>
